feat: lake: separate leanir job - #14906
Open
tydeu wants to merge 3 commits into
Open
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator
|
Reference manual CI status:
|
|
Mathlib CI status (docs):
|
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Aug 29, 2026
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Aug 29, 2026
leanprover-bot
added a commit
to leanprover/reference-manual
that referenced
this pull request
Aug 29, 2026
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Aug 29, 2026
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Aug 29, 2026
leanprover-bot
added a commit
to leanprover/reference-manual
that referenced
this pull request
Aug 29, 2026
tydeu
marked this pull request as ready for review
August 29, 2026 03:14
tydeu
commented
Aug 29, 2026
Comment on lines
+94
to
+96
| -- As the environment imports the module to compile, it does not inherit its package. | ||
| -- Take it from the setup. | ||
| let env := env.setModulePackage setup.package? |
Member
Author
There was a problem hiding this comment.
@Kha This changes non-Lake code and is thus probably the bit that most needs your review.
tydeu
commented
Aug 29, 2026
Comment on lines
+396
to
+424
| let info := {info with | ||
| irSigTrace := | ||
| if nonModule || imp.importAll then | ||
| info.irSigTrace | ||
| |>.mix expInfo.allTransTrace | ||
| |>.mix expInfo.allArtsTrace.withoutInputs | ||
| else | ||
| info.irSigTrace | ||
| |>.mix expInfo.irSigTransTrace | ||
| |>.mix expInfo.irSigArtsTrace.withoutInputs | ||
| } | ||
| if imp.isExported then | ||
| if imp.isMeta then | ||
| {info with | ||
| transTrace := info.transTrace | ||
| {info with | ||
| transTrace := | ||
| if imp.isMeta then | ||
| info.transTrace | ||
| |>.mix expInfo.metaTransTrace | ||
| |>.mix expInfo.metaArtsTrace.withoutInputs | ||
| |>.withoutInputs | ||
| } | ||
| else | ||
| {info with | ||
| transTrace := info.transTrace | ||
| else | ||
| info.transTrace | ||
| |>.mix expInfo.transTrace | ||
| |>.mix expInfo.artsTrace.withoutInputs | ||
| |>.withoutInputs | ||
| } | ||
| irSigTransTrace := info.irSigTransTrace | ||
| |>.mix expInfo.irSigTransTrace | ||
| |>.mix expInfo.irSigArtsTrace.withoutInputs | ||
| |>.withoutInputs | ||
| } |
Member
Author
There was a problem hiding this comment.
@Kha This code here (outside transTrace) is the new trace code. It could also use your review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR splits
leanirinto a separate Lake job and target.When the Lean option
compiler.postponeCompileris enabled, only*.oleanfiles are produced by the initial Lean elaboration. Code generation then occurs in a subsequentirArtsjob that callsleanirto emit.cand.ir/.ir.sigfiles for the module. This job traces the.ir.sigfiles of the import graph and only rebuilds when they change. Postponed compilation inirArtsdoes not yet make use of the Lake artifact cache. That will need a follow-up PR.Because
#evalin the serve needs IR and Lake does not currently distinguish between server and CLI builds, all module elaboration still waist for the IR of there imports to be built. However, this now more clearly demarcated in the code byfetchExportInfoand could evolve in the future if a separateserverExportInfois developed.A test of postponed compilation is added as
moduleCodegen.Split from #13169.